<template>
	<el-container>
		<el-main>
			<el-form  ref="item" :model="item" label-width="150px" style="margin-top: 1%;">
				 
			    <el-form-item label="名字" >
                    <el-col :span="10">
					    <el-input v-model="item.name"></el-input>
                    </el-col>
				</el-form-item>   
			    <el-form-item label="来源id" >
                    <el-col :span="10">
					    <el-input v-model="item.sourceId"></el-input>
                    </el-col>
				</el-form-item>   
			    <el-form-item label="来源名字" >
                    <el-col :span="10">
					    <el-input v-model="item.sourceName"></el-input>
                    </el-col>
				</el-form-item>   
			    <el-form-item label="图片地址" >
                    <el-col :span="10">
					    <el-input v-model="item.imgUrl"></el-input>
                    </el-col>
				</el-form-item>   
			    <el-form-item label="是否显示" >
                    <el-col :span="10">
					    <el-input v-model="item.isShow"></el-input>
                    </el-col>
				</el-form-item>   
			    <el-form-item label="来源标识" >
                    <el-col :span="10">
					    <el-input v-model="item.sourceLogo"></el-input>
                    </el-col>
				</el-form-item>     				<el-form-item>
					<el-button type="primary" @click="onSubmit">保存</el-button>
					
				</el-form-item>
			</el-form>
		</el-main>
	</el-container>
</template>

<script>
	import {post} from "@/api/user";
	export default {
		name: "lvyouCateImgedit",
		data(){
			return {
				item:{
				},
				id:-1,
			}
		},
		methods:{
			getItemById(){
				let _this = this
				post('/lvyou/lvyouCateImg/getById',{
					id:_this.id
				}).then(res =>{
					_this.item =  res.i
				}).catch(err =>{

				})
			},
			onSubmit(){
				this.save()
			},
			save(){
				let _this = this
				post('/lvyou/lvyouCateImg/save',_this.item).then(res =>{
					_this.$router.push({path:'/lvyouCateImg/list'})
				}).catch(err =>{

				})
			}
		},
		created(){
			this.id =   this.$route.query.id
			this.getItemById()
		}
	}
</script>

<style scoped>
    .el-form-item{
        width: 80%;
    }
</style>
